package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduSjtj04Integration;
import com.jwsoft.manager.common.vo.eduSjtj04.EduSjtj04VO;
import com.jwsoft.manager.common.vo.eduSjtj04.EduSjtj04KeyVO;
import com.jwsoft.manager.common.vo.eduSjtj04.EduSjtj04QueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 指标04总表网关
 *
 * @author zhiyuan
 * @since 2023-12-07
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "指标04总表", description = "指标04总表")
public class EduSjtj04Controller {

    @Autowired
    public EduSjtj04Integration eduSjtj04Integration;

    @Operation(summary = "指标04总表分页查询",description = "指标04总表分页查询")
    @PostMapping(value = "/eduSjtj040001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSjtj04VO>> getList(@RequestBody @Validated EduSjtj04QueryVO vo) {
        return AppResponse.successData(eduSjtj04Integration.getList(vo));
    }

    @Operation(summary = "指标04总表根据主键查询详情",description = "指标04总表根据主键查询详情")
    @PostMapping(value = "/eduSjtj040002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj04VO> getById(@RequestBody @Validated EduSjtj04KeyVO vo) {
        return AppResponse.successData(eduSjtj04Integration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "指标04总表新增",description = "指标04总表新增")
    @PostMapping(value = "/eduSjtj040004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj04VO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSjtj04VO vo) {
        return AppResponse.successData(eduSjtj04Integration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "指标04总表修改",description = "指标04总表修改")
    @PostMapping(value = "/eduSjtj040005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSjtj04VO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSjtj04VO vo) {
        return AppResponse.successData(eduSjtj04Integration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "指标04总表删除",description = "指标04总表删除")
    @PostMapping(value = "/eduSjtj040006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSjtj04KeyVO vo) {
        eduSjtj04Integration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
